#include <map>
#include <string>

using std::string;

#ifndef VARS_H
#define VARS_H


namespace Org
{    
    namespace Discogs
    {
        const extern string domain;
        const extern string api_suffix;
    }

    namespace Remote
    {
        const extern string url_rule_groups;
        const extern string url_rule_group_rules;
        const extern string domain;
    }

    class Vars
    {
        public:
            Vars() { };

            enum e_action {ORG_COPY, ORG_MOVE, ORG_DELETE, ORG_RENAME, ORG_COPY_DIR, ORG_MOVE_DIR, ORG_DELETE_DIR, ORG_RENAME_DIR, ORG_NO_ACTION};
            enum e_node_type {ORG_NODE_CONDITION, ORG_NODE_BOOL, ORG_NO_NODE}; // t attr.
            enum e_operation {ORG_AND, ORG_OR, ORG_NAND, ORG_XOR, ORG_NO_OPERATION}; // o attr.
            enum e_search_type {ORG_SCENE, ORG_ID3, ORG_FILE, ORG_DIR, ORG_NO_SEARCH_TYPE};

            static e_operation get_operation(std::string operation) {
                if (operation == "and") {
                    return Vars::ORG_AND;
                } else if (operation == "or") {
                    return Vars::ORG_OR;
                } else if (operation == "nand") {
                    return Vars::ORG_NAND;
                }

                return Vars::ORG_NO_OPERATION;
            }

            static std::string get_operation(e_operation operation) {
                if (operation == Vars::ORG_AND) {
                    return std::string("and");
                } else if (operation == Vars::ORG_OR) {
                    return std::string("or");
                } else if (operation == Vars::ORG_NAND) {
                    return std::string("nand");
                }

                return std::string("nooperation");
            }

            static e_action get_action(std::string action) {
                if (action == "copy") {
                    return Vars::ORG_COPY;
                } else if (action == "move") {
                    return Vars::ORG_MOVE;
                } else if (action == "delete") {
                    return Vars::ORG_DELETE;
                } else if (action == "copy_dir") {
                    return Vars::ORG_COPY_DIR;
                }

                return Vars::ORG_NO_ACTION;
            }

            static std::string get_action(e_action action) {
                if (action == Vars::ORG_COPY) {
                    return std::string("copy");
                } else if (action == Vars::ORG_MOVE) {
                    return std::string("move");
                } else if (action == Vars::ORG_DELETE) {
                    return std::string("delete");
                } else if (action == Vars::ORG_COPY_DIR) {
                    return std::string("copy_dir");
                }

                return std::string("noaction");
            }

            static e_search_type get_search_type(std::string search_type) {
                if (search_type == "ID3") {
                    return ORG_ID3;
                } else if (search_type == "scene") {
                    return ORG_SCENE;
                } else if (search_type == "fs") {
                    return ORG_FILE;
                } else if (search_type == "dir") {
                    return ORG_DIR;
                }
                return ORG_NO_SEARCH_TYPE;
            }

            static std::string get_search_type(e_search_type search_type) {
                if (search_type == ORG_ID3) {
                    return "ID3";
                } else if (search_type == ORG_SCENE) {
                    return "scene";
                } else if (search_type == ORG_FILE) {
                    return "fs";
                } else if (search_type == ORG_DIR) {
                    return "dir";
                }
                return std::string("nosearchtype");
            }

            static std::map<std::string, e_action> map_action;
    };
}


#endif // VARS_H
